package com.dq.mail.utils;

import com.dq.mail.entity.User;

/**
 * @ClassName: ThreadUserHolder
 * @Description: 本地线程User (ThreadLocal)
 * @Author: app-backend-public_小强 (QQ:2680825683)
 * @Since: 2023/3/3 15:34
 */
public class ThreadUserHolder {
    private static final ThreadLocal<User> tl = new ThreadLocal<>();

    public static void saveUser(User user){
        tl.set(user);
    }

    public static User getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
